
{extend name='public/alert' /}

{block name="content"}

<div class="layui-fluid">
    <div class="layui-card">

        <div class="layui-card-body" style="padding: 15px;">
            <form class="layui-form " action="" lay-filter="form">

                <div class="layui-form-item">
                    <label class="layui-form-label">公众号名称：</label>
                    <div class="layui-input-inline">
                        <input type="text" name="wxname" lay-verify="required" lay-vertype="tips" lay-reqtext="请输入公众号名称" autocomplete="off" placeholder="公众号名称" class="layui-input">
                        <p class="help-block"> 在4到25个字符之间。</p>
                    </div>

                </div>
                {:token()}
                <div class="layui-form-item">
                    <label class="layui-form-label">类型：</label>
                    <div class="layui-input-block">
                        <input type="radio" name="type" lay-filter="type" checked value="1" title="普通订阅号">
                        <input type="radio" name="type" lay-filter="type" value="2" title="认证订阅号">
                        <input type="radio" name="type" lay-filter="type" value="3" title="普通服务号">
                        <input type="radio" name="type" lay-filter="type" value="4" title="认证服务号/认证媒体/政府订阅号">
                    </div>
                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label">APP_ID：</label>
                    <div class="layui-input-inline">
                        <input type="text" name="app_id" placeholder="APP_ID" lay-verify="required" lay-vertype="tips" lay-reqtext="请输入APP_ID" autocomplete="off" class="layui-input">
                    </div>

                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">APP_SECRET：</label>
                    <div class="layui-input-block">
                        <input type="text" name="app_secret" placeholder="APP_SECRET" lay-verify="required" lay-vertype="tips" lay-reqtext="请输入APP_SECRET" autocomplete="off" class="layui-input">
                    </div>

                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label">aeskey：</label>
                    <div class="layui-input-inline">
                        <input type="text" name="aeskey" placeholder="aeskey" lay-verify="required" lay-vertype="tips" lay-reqtext="请输入aeskey" autocomplete="off" class="layui-input">

                    </div>

                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">encode加密：</label>
                    <div class="layui-input-block">
                        <input type="text" name="encode" placeholder="encode加密" lay-verify="" class="layui-input">
                        <p class="help-block"> 可不填。</p>
                    </div>

                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label">对接Token：</label>
                    <div class="layui-input-inline">
                        <input type="text" name="w_token" placeholder="对接Token" lay-verify="required" lay-vertype="tips" lay-reqtext="请输入对接Token" autocomplete="off" class="layui-input">
                    </div>
                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label">对接地址：</label>
                    <div class="layui-input-block">
                        <input type="text" name="related" placeholder="对接地址" lay-verify="required" lay-vertype="tips" lay-reqtext="请输入对接地址" autocomplete="off" class="layui-input">
                        <p class="help-block"> 微信对接地址，http/https开头。</p>
                    </div>
                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label">原始ID：</label>
                    <div class="layui-input-inline">
                        <input type="text" name="origin_id" placeholder="原始ID" lay-verify="required" lay-vertype="tips" lay-reqtext="请输入原始ID" autocomplete="off"class="layui-input">
                    </div>
                </div>

                {if isset($info['id'])}

                <input type="hidden" name="id"  value="$info.id" >

                {:widget('common/forms/Pic',array('qr|二维码|请上传二维码||点击上传',$info.qr,700,600))}
                {:widget('common/forms/Pic',array('logo|LOGO|请上传LOGO||点击上传',$info.logo,700,600))}

                {else}
                {:widget('common/forms/Pic',array('qr|二维码|请上传二维码||点击上传','',700,600))}

                {:widget('common/forms/Pic',array('logo|LOGO|请上传LOGO||点击上传','',700,600))}
                {/if}


                <div class="layui-form-item">
                    <label class="layui-form-label">状态：</label>
                    <div class="layui-input-block">
                        <input type="radio" name="status" lay-filter="status"  value="1" title="启用">
                        <input type="radio" name="status" lay-filter="status" checked value="0" title="关闭">
                    </div>
                </div>

                {:widget('common/forms/submit',array('add','立即提交',2))}

            </form>
        </div>
    </div>
</div>



<script>
    layui.use(['element', 'form', 'jquery','lucky'], function () {
        let element = layui.element;
        let table = layui.table;
        let form = layui.form;
        let $ = layui.jquery;
        let lucky=layui.lucky;
        let info = {:json_encode($info)};
        form.val("form", info);
        form.render();

        form.on('submit(add)', function (data) {
            lucky.FormSubmit("{:url('add')}",data.field,"table_id",1);
            return false;
        });
    })
</script>

{/block}